<?php
namespace app\controllers;

use Yii;
use yii\web\Controller;
use app\models\UploadForm;
use yii\web\UploadedFile;

class FileController extends Controller
{
    public function actionUpload()
    {
        $model = new UploadForm();

        if (Yii::$app->request->isPost) {
            $model->imageFile = UploadedFile::getInstance($model, 'imageFile');
             $model->Upload();
            $ap=$model->Upload();
            if ($ap['code']==false) {
                return "文件上传失败";
            }else{
                return "上传成功";
            }                  
        }
        return $this->render('upload', ['model' => $model]);
    }

}




?>